<!--------------------------------- for DSO Summary Search --------------------------------->
<table id="summarySearch" width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr> 
    <td class="summary_top" colspan="2"></td>
  </tr>
  <%
    OvalCustomColumn column = new OvalCustomColumn(strLanguageCode);
    java.util.Vector searchList = null;
    if (strTableName.length() != 0)
      searchList = (java.util.Vector)column.getSearchableList(strTableName,strSearchNames);
    if (searchList == null || searchList.size() == 0)
      searchList = strSearchNames;
  %>
  <tr>
    <td nowrap width="66"><%= label.getLabelName("L_QuickSearch") + label.getLabelName("L_Colon") %></td>
    
    <td width="10">
      <select name="searchnamealias" onChange="javascript:changeSearchName()">
      <logic:iterate id="searchid" collection="<%= searchList %>">
        <%
          java.util.HashMap searchHash = (java.util.HashMap)pageContext.getAttribute("searchid");
          String strSelect = "";
          String strName = (String)searchHash.get("columnname");
          if (strName.equalsIgnoreCase(strCurSearchName))
            strSelect = "Selected";
        %>
        <option <%=JspHelper.filterNull( strSelect )%> value="<%=JspHelper.filterNull( strName + "^" + (String)searchHash.get("columntype") )%>">
        <%=JspHelper.filterNull( (String)searchHash.get("columndesc") )%>
        </option>
      </logic:iterate>
      </select>
    </td>
    
    <td nowrap>
      <input type="text" name="searchvalue" size="10" value="<%=JspHelper.filterNull( strCurSearchValue )%>" style="display:<%=JspHelper.filterNull( comDisplay )%>">
      <span id="spec" style="display:<%=JspHelper.filterNull( speDisplay )%>">
        <input type="text" name="searchvalue1" size="10" value="<%=JspHelper.filterNull( strCurSearchValue1 )%>">--
        <input type="text" name="searchvalue2" size="10" value="<%=JspHelper.filterNull( strCurSearchValue2 )%>">
      </span>
    </td>
    
    <td width="6">
      <a href="javascript:page_searchDSO()"><img src="<%= ConstantProp.DEFAULT_ROOT_PATH %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a></td><td width="800">
    </td>
  </tr>
</table>

<script language="JavaScript">

function page_searchDSO()
{
  var arr = document.all.item("searchnamealias").value.split("^");
  
  if (arr[1] == "date" || arr[1] == "Date")
  {
    var val1 = dateCheck(document.all.searchvalue1.value, "yyyy-MM-dd", "<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>");
    var val2 = dateCheck(document.all.searchvalue2.value, "yyyy-MM-dd", "<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>");
    if (val1 < 0 || val2 < 0)
    {
      alert("<%= message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_QuickSearch",false)) %>");
      return;
    }
  }
  else if (arr[1] == "integer" || arr[1] == "Integer")
  {
    if (!isNumberNull(document.all.searchvalue1.value) || !isNumberNull(document.all.searchvalue2.value))
    {
      alert("<%= message.getMessageDesc("VALUE_MUST_BE_INT",label.getLabelName("L_QuickSearch",false)) %>");
      return;
    }
  }
  else if (arr[1] == "double" || arr[1] == "Double")
  {
    if (!isNumberNull(document.all.searchvalue1.value) || !isNumberNull(document.all.searchvalue2.value))
    {
      alert("<%= message.getMessageDesc("VALUE_MUST_BE_NUMBER",label.getLabelName("L_QuickSearch",false)) %>");
      return;
    }
  }
  
  summaryData.search(arr[0], arr[1], (document.all.searchvalue.style.display == "none") ? document.all.searchvalue1.value + "^" + document.all.searchvalue2.value : document.all.searchvalue.value)
}

function changeSearchName()
{
  document.all.item("searchvalue").value = "";    
  document.all.item("searchvalue1").value = "";    
  document.all.item("searchvalue2").value = "";
  
  var arr = document.all.item("searchnamealias").value.split("^");
  if(document.all.item("spec") != null && document.all.item("searchvalue") != null  && document.all.item("searchvalue1") != null && document.all.item("searchvalue2") != null)
  { 
    if(arr[1] == "date" || arr[1] == "double" || arr[1] == "integer")
    {     
      document.all.item("spec").style.display = "";
      document.all.item("searchvalue").style.display = "none";    
    }
    else
    {
      document.all.item("spec").style.display = "none";
      document.all.item("searchvalue").style.display = "";    
    }
  }
}

</script>
